3 ...\PTVR_Researchers\Python_Scripts\Demos\Pointing\laser_beam_axis.py
6 Goal : show how to change the axis of the laser beam with respect to the
7 reference axis of the handcontroller.
8 This is achieved in the PointingLaser object with the
9 'laser_beam_x_y_rotation' parameter.
10 This modification only affects the VISUAL appearance of the laser beam.
12 The axis of the laser beam can be defined with rotation coordinates or
13 with perimetric coordinates wrt the handcontroller reference axis.
15 Task: Modify the values of 'my_laser_axis_wrt_handcontroller_reference_axis',
16 and see how it modifies the axis of the laser beam (this modification is
17 dependent on the headset manufacturer (see below) .
20 For the the HTC Vive Pro series pointers, the reference axis
21 of the handcontroller is aligned with the long axis of the handcontroller.
23 For the Quest 1, 2 and 3 headsets, the reference axis of
24 the handcontroller is tilted about the X axis of the handcontroller.
27 In this demo, the laser beam is tilted by 45 degrees about the x axis
28 of the handcontroller (as specified by x and y rotations)
30 Important note concerning scripts that use handcontrollers:
31 It is necessary to specify your VR system's manufacturer if:
32 a/ your code contains a PointedAt Event triggered by a handcontroller
34 b/ your code contains a PointingLaser () object.
35 This is specified in the The3DWorld() in the following way:
36 headset_manufacturer = "Vive" (default) refers to the HTC Vive pro series headsets.
37 headset_manufacturer = "Oculus" refers to the Quest 1, 2 or 3 headsets (in keeping
38 with OpenXR terminology).
40 my_world = The3DWorld (
41 headset_manufacturer = "Vive" # "Vive" by default
45 Things to check in the PointingLaser object when using different
46 headset manufacturers:
47 ex. With the Quest, you should do
48 laser_beam_x_y_rotation = np.array([60, 0]) # 60 ° about X axis
49 in the PointingLaser () object.
50 Otherwise the laserbeam will be directed upwards in an awkward and non
74 my_laser_axis_wrt_handcontroller_reference_axis = np.array([45, 0])
80 flag_x_y_rotation_coordinates =
True
91 headset_manufacturer =
"Vive"
104 is_right_hand_controller_visible =
True,
108 if (flag_x_y_rotation_coordinates ==
True):
111 laser_beam_x_y_rotation = my_laser_axis_wrt_handcontroller_reference_axis
113 if (flag_x_y_rotation_coordinates ==
False):
116 laser_beam_ecc_hm = my_laser_axis_wrt_handcontroller_reference_axis
119 my_scene.place_pointing_laser(my_laser_beam)
121 my_world.add_scene(my_scene)
125 if __name__ ==
"__main__":
def LaunchThe3DWorld(jsonFileCategory="Externals")